package itheima02;
/*
    1.定义子类继承Thread类
    2.子类覆盖重写run方法,指定线程任务

    ctrl+O: 选择性覆盖重写
    ctrl+I: 必须覆盖重写
 */
public class MyThread extends Thread{
    @Override
    public void run() {
        //获取线程名称
        String threadName = getName();
        for (int i = 0; i < 10; i++) {
            //System.out.println(threadName+"...."+i);
            System.out.println(Thread.currentThread().getName()+"...."+i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
